﻿using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using MongoDB.Driver.Linq;
using System.ComponentModel;

namespace Vav.Api
{
    [Description("系统相关")]
    public class BaseController : Controller
    {
        protected ActionResult<ApiBaseModel> ApiSuccess(object model, string msg = "success")
        {
            return new ApiBaseModel { msg = msg, status = true, result = model, total = 0 };
        }
        protected ActionResult<ApiBaseModel> ApiSuccess(string msg = "success")
        {
            return new ApiBaseModel { msg = msg, status = true, result = null, total = 0 };
        }
        protected ActionResult<ApiBaseModel> ApiSuccess(object model, int Total, string msg = "success")
        {
            return new ApiBaseModel { msg = msg, status = true, result = model, total = Total };
        }
        protected ActionResult<ApiBaseModel> ApiFail(string msg)
        {
            return new ApiBaseModel { msg = msg, status = false, result = null, total = 0 };
        }
    }
}
